<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title></title>
<script src="js/jquery.js"></script>
<script>
$(document).ready(function()
		{
	  	     	
	$("#s1").click(function(){
		
		var path=$("#f1").val().split("\\");
		//alert(path);
		$("#file_name").val(path[path.length-1]);
		});
	$("#allsts").change(function() {
		var isChecked = $('.selsts').attr('checked') ? true : false;
		if (isChecked == false) {
			$(".selsts").attr('checked', true);
		} else {
			$(".selsts").attr('checked', false);
		}

	});

	$('#search').keyup(function() {
		searchTable($(this).val());
	});

	$("#example").tablesorter({
		// pass the headers argument and assing a object 
		headers : {
			// assign the secound column (we start counting zero) 
			8 : {
				// disable it by setting the property sorter to false 
				sorter : false
			}
		}
	});
	});
function searchTable(inputVal) {
	var table = $('#example');
	table.find('tr').each(function(index, row) {
		var allCells = $(row).find('td');
		if (allCells.length > 0) {
			var found = false;
			allCells.each(function(index, td) {
				var regExp = new RegExp(inputVal, 'i');
				if (regExp.test($(td).text())) {
					found = true;
					return false;
				}
			});
			if (found == true)
				$(row).show();
			else
				$(row).hide();
		}
	});
}
</script>
<link rel="stylesheet" type="text/css" href="css/style.css">

<style type="text/css">
#top{
	top: 0;
}
.scrollable { width:1100px; height:490px; overflow-y:auto; overflow-x:auto; clip-rect:(0px, 1100px, 490px, 0px); }


#right_icon a:LINK {
	color: white;
	text-decoration: none;
}

#right_icon a:VISITED {
	color: white;
	
}
#right_icon :HOVER {
	background-color: #CD2626;
}

#hid {
	visibility: hidden;
}
</style>

</head>
<body>
<form action="uploadtimetable?value=updatetimetable" method="post" enctype="multipart/form-data" >
	<table>
	<tr>
	
		<td>
			<s:select list ="batch" listValue="batch_name" listKey="batch_id" name="batch_id" value="batch_name"></s:select>
		</td>
	</tr>
	
	</table>
</form>

<form action="uploadtimetable?value=updatetimetable" method="post" enctype="multipart/form-data" >
<input type="hidden" id="file_name" name="file_name"/>

<table  align="left">
<tr>
	<td>Subject</td>
	<td><input type="text" name="subject" /></td>
</tr>
<tr>
	<td>Upload New Schedule</td>
	<td><input type="file" id="f1" name="attached_file"/></td>
</tr>

<tr>
<td colspan="2" align="center"><input type="submit" id="s1" value="Upload Schedule"/></td></tr>
</table>
<table id="example" class="tablesorter" width="100%" style="border-color: gray; border-style: solid; border-width: thin;">
		<thead>
			<tr bgcolor="yellow">
				<th>Subject</th>
				<th>Document Name</th>
				<th>Date of Upload</th>
				<th>batch_id</th>
				<th>DELETE</th>
			</tr>
		</thead>
		<tbody>
			
			<s:iterator value="timetable">
				<tr>
					<td><s:property value="subject" /></td>
					<td>
					<a href="DownloadTimeTable.jsp?batch_id=<s:property value="batch_id"/>&filename=<s:property value="document_name"/>"><s:property value="document_name" /></a>
					</td>
					<td><s:property value="upload_date" /></td>
					<td><s:property value="batch_id" /></td>
					<td><a href="deletetimetable.action?attachment_id=<s:property value="attachment_id"/>&value=deletetimetable">DELETE</a></td>
				</tr>
		</s:iterator>
		</tbody>
</table>
</form>
</body>
</html>